package com.lion.ball.app.models.admin;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Chris Chan
 * Create On 2025/8/26 下午5:43
 * Use for: 购物车 参数
 * Explain:
 */
public class UserBaseInfoResult implements Serializable {
    private static final long serialVersionUID = 1L;

    // 主键
    private Long id;
    // 编码
    private Long code;
    // 用户名
    private String username;
    // 角色
    private List<String> roles;

    public UserBaseInfoResult() {
    }

    public UserBaseInfoResult(Long id, String username, List<String> roles) {
        this.id = id;
        this.username = username;
        this.roles = roles;
    }

    public UserBaseInfoResult(Long code, Long id, String username, List<String> roles) {
        this.code = code;
        this.id = id;
        this.username = username;
        this.roles = roles;
    }

    public UserBaseInfoResult(Long code, Long id, String username, String... roles) {
        this.code = code;
        this.id = id;
        this.username = username;
        this.roles = Stream.of(roles).collect(Collectors.toList());
    }

    public static UserBaseInfoResult create(Long code, Long id, String name, List<String> roles) {
        return new UserBaseInfoResult(code, id, name, roles);
    }

    public static UserBaseInfoResult of(Long code, Long id, String name, List<String> roles) {
        return new UserBaseInfoResult(code, id, name, roles);
    }

    public static UserBaseInfoResult create(Long code, Long id, String name, String... roles) {
        return new UserBaseInfoResult(code, id, name, roles);
    }

    public static UserBaseInfoResult of(Long code, Long id, String name, String... roles) {
        return new UserBaseInfoResult(code, id, name, roles);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public List<String> getRoles() {
        return roles;
    }

    public void setRoles(List<String> roles) {
        this.roles = roles;
    }
}
